<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <father></father>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        let son = {
            template:"<div>son -- {{i.money}} <button @click='getMore'>需要更多</button></div>",
            props: ['i'],
            methods: {
                getMore() {
                   this.i.money = 300
                }
            }
        }

        let father = {
            // 动态绑定属性
            template: "<div>father<son :i='info'></son></div>",
            data() {
                return {
                    info: {
                        money: 100
                    }
                }
            },
            methods: {
                moreMoney(val) {
                    this.money += val
                }
            },
            components: {
                son
            }
        }

        const app = new Vue({
            el: "#app",
            data: {

            },
            components: {
                father
            }
        })
    </script>
</body>
</html>